<!--{template common/header}-->

<!--{if !empty($message)}-->
<script type="text/javascript" onload="1">
<!--{eval $_G['setting']['sitename'] = str_replace('\\\'', '\\\\\'', $_G['setting']['sitename']);}-->
if(document.body.stat) document.body.stat('Thank you for registration!', 'index.php?option=member&task={$_G[setting][regname]}');
display('main_regmessaqge');
display('layer_reg');
display('layer_regmessage');
	$$$('messageleft1').innerHTML = '<p>{lang Thank you for registration!} <!--{echo addslashes($_G['setting']['sitename'])}--></p>';
	<!--{eval $dreferer = str_replace('&amp;', '&', dreferer());}-->
	<!--{if $dreferer}-->
		$$$('messageright1').innerHTML = '<a href="javascript:;" onclick="location.href=\'$dreferer\';">{lang If the page does not respond, please click here to refresh}</a>';
		setTimeout('location.href=\'$dreferer\'', $mrefreshtime);
	<!--{else}-->
		$$$('messageright1').innerHTML = '<a href="javascript:;" onclick="location.reload()">{lang If the page does not respond, please click here to refresh}</a>';
	<!--{/if}-->
setMenuPosition('fwin_register', 'fwin_register', '00');
</script>
<!--{else}-->
<!--{if empty($_G['gp_infloat'])}-->
<div id="ct" class="wp cl">
	<div class="mn">
<!--{/if}-->
<div class="blr" id="main_regmessaqge">
	<h3 id="layer_reginfo_t" class="flb"{if $bbrules && $bbrulesforce} style="display: none"{/if}>
		<em id="returnmessage4"><!--{if !empty($_G['gp_infloat'])}--><!--{if $_G[gp_action] != 'activation'}-->$_G['setting']['reglinkname']<!--{else}-->{lang Need to activate your account}<!--{/if}--><!--{/if}--></em>
		<span>
			<!--{if !empty($_G['gp_infloat'])}--><a href="javascript:;" class="flbc" onclick="hideWindow('register')" title="{lang Close}">{lang Close}</a><!--{/if}-->
		</span>
	</h3>
	<div id="layer_bbrule"{if !($bbrules && $bbrulesforce)} style="display: none"{/if}>
		<h3 class="flb"><em>$_G['setting']['sitename'] {lang Website Terms of Service}</em>
			<span>
				<!--{if !empty($_G['gp_infloat'])}--><a href="javascript:;" class="flbc" onclick="hideWindow('register')" title="{lang Close}">{lang Close}</a><!--{/if}-->
			</span>
		</h3>
		<div class="c cl{if !empty($_G['gp_infloat'])} floatwrap{/if}">$bbrulestxt</div>
		<p class="fsb pns cl{if empty($_G['gp_infloat'])} hm{/if}">
			<button class="pn pnc" onclick="$$$('agreebbrule').checked = true;display('layer_reg');display('layer_reginfo_t');display('layer_reginfo_b');display('layer_bbrule');{if $_G['setting']['sitemessage'][register] && ($bbrules && $bbrulesforce)}showRegprompt();{/if}"><span>{lang Agree}</span></button>
			<button class="pn" onclick="{if !empty($_G['gp_infloat'])}hideWindow('register'){else}location.href='{if $_G['gp_referer']}$_G[gp_referer]{else}$_G['referer']{/if}'{/if}"><span>{lang Disagree}</span></button>
		</p>
	</div>
	<form method="post" autocomplete="off" name="register" id="registerform" enctype="multipart/form-data" onsubmit="ajaxpost('registerform', 'returnmessage4', 'returnmessage4', 'onerror');return false;" action="index.php?option=member&task={$_G[setting][regname]}">
		<div id="layer_reg" class="c cl"{if $bbrules && $bbrulesforce} style="display: none"{/if}>
			<input type="hidden" name="regsubmit" value="yes" />
			<input type="hidden" name="formhash" value="{FORMHASH}" />
			<input type="hidden" name="referer" value="{if $_G['gp_referer']}$_G[gp_referer]{else}$_G['referer']{/if}" />
			<!--{if !empty($_G['gp_infloat'])}--><input type="hidden" name="handlekey" value="$_G['gp_handlekey']" /><!--{/if}-->
			<div class="lgfm">
				<div id="reginfo_a">
					<span id="activation_hidden"{if $_G[gp_action] == 'activation'} style="display:none"{/if}>
					<!--{if $invite}-->
						<span>
							<label><em>{lang Recommended}:</em><a href="index.php?option=member&task=profile&uid=$invite[uid]" target="_blank">$invite[username]</a></label>
						</span>
					<!--{/if}-->
					<label><em>{lang Username}:</em><input type="text" id="username" name="{$_G['setting']['reginput']['username']}" autocomplete="off" size="25" maxlength="15" value="" onBlur="checkusername()" tabindex="1" class="txt" /> *</label>
					<label><em>{lang Password}:</em><input type="password" name="{$_G['setting']['reginput']['password']}" size="25" id="password" tabindex="1" class="txt" /> *</label>
					<label><em>{lang Confirm}:</em><input type="password" name="{$_G['setting']['reginput']['password2']}" size="25" id="password2" onkeypress="detectCapsLock(event, this)" tabindex="1" value="" class="txt" /> *</label>
					<label><em>{lang Email}:</em><input type="text" name="{$_G['setting']['reginput']['email']}" autocomplete="off" size="25" id="email" onBlur="checkemail()" tabindex="1" class="txt" /> *</label>
					</span>
					<!--{if $_G[gp_action] == 'activation'}-->
						<span id="activation_user">
							<label><em>{lang Username}:</em>$username</label>
						</span>
					<!--{/if}-->
				</div>
				<div id="reginfo_b"{if !empty($_G['gp_infloat'])} style="display:none"{/if}>
					<!--{loop $_G['cache']['fields_register'] $field}-->
					<!--{if $htmls[$field['fieldid']]}-->
						<div class="reginfo"{if $field['description']} title="{echo htmlspecialchars($field[description])}"{/if}><em>$field[title]:</em><div id="td_{$field[fieldid]}" class="reg_c">$htmls[$field['fieldid']]</div><!--{if $field['required']}-->&nbsp;*<!--{/if}--></div>
					<!--{/if}-->
					<!--{/loop}-->
				</div>
			</div>
			<div class="lgf"{if $_G[gp_action] == 'activation'} style="margin-top: 10px;"{/if}>
				<h4>{lang Have an account?}<a href="index.php?option=member&task=login" onclick="hideWindow('register');showWindow('login', this.href);return false;">{lang Login now}</a></h4>
			</div>
		</div>
		<p id="layer_reginfo_b" class="fsb pns cl"{if $bbrules && $bbrulesforce} style="display: none"{/if}>
			<!--{if $_G['setting']['sitemessage'][register]}--><a href="javascript:;" id="custominfo_register" class="y"><img src="{IMGDIR}/info_small.gif" alt="{lang FAQ}" /></a><!--{/if}-->
			<span id="reginfo_a_btn">
				<!--{if $_G[gp_action] != 'activation'}--><em>&nbsp;</em><!--{/if}-->
				<button class="pn pnc" id="registerformsubmit" type="submit" name="regsubmit" value="true" tabindex="1"><span><!--{if $_G[gp_action] == 'activation'}-->{lang Activation}<!--{else}-->{lang Submit}<!--{/if}--></span></button>
				<!--{if $bbrules}-->
					<input type="checkbox" class="pc" name="agreebbrule" value="$bbrulehash" id="agreebbrule" checked="checked" /> <label for="agreebbrule">{lang Agree}<a href="javascript:;" onclick="display('layer_reg');display('layer_reginfo_t');display('layer_reginfo_b');display('layer_bbrule');">{lang Website Terms of Service}</a></label>
				<!--{/if}-->
			</span>
		</p>
	</form>
</div>
<div id="layer_regmessage"{if empty($_G['gp_infloat'])} class="f_c blr nfl"{/if} style="display: none">
	<h3 class="flb">
		<!--{if !empty($_G['gp_infloat'])}-->
		<em>{lang User Login}</em>
		<span><a href="javascript:;" class="flbc" onclick="hideWindow('login')" title="{lang Close}">{lang Close}</a></span>
		<!--{/if}-->
	</h3>
	<div class="c"><div class="alert_right">
		<div id="messageleft1"></div>
		<p class="alert_btnleft" id="messageright1"></p>
	</div>
</div>

<script type="text/javascript" reload="1">
hideWindow('login');
<!--{if $_G[gp_action] != 'activation'}-->
function initinput_register() {
	<!--{if !($bbrules && $bbrulesforce)}-->
	$$$('registerform').username.focus();
	<!--{/if}-->
}
if(BROWSER.ie && BROWSER.ie < 7) {
	setTimeout('initinput_register()', 500);
} else {
	initinput_register();
}
<!--{/if}-->

<!--{if $_G['setting']['sitemessage'][register]}-->
function showRegprompt() {
	showPrompt('custominfo_register', 'mouseover', '<!--{echo trim($_G['setting']['sitemessage'][register][array_rand($_G['setting']['sitemessage'][register])])}-->', $_G['setting']['sitemessage'][time]);
}
<!--{if !($bbrules && $bbrulesforce)}-->
showRegprompt();
<!--{/if}-->
<!--{/if}-->

var profile_username_toolong = '{lang Sorry, your user name more than 15 characters, please return to enter a shorter user name.}';
var profile_username_tooshort = '{lang Sorry, your username is less than 3 characters, please return to enter a long user name.}';
var lastusername = lastpassword = lastemail = lastinvitecode = '';

function errorhandle_register(msg, values) {
	$$$('returnmessage4').className = msg == '<!--{echo addslashes($_G[setting][reglinkname])}-->' ? '' : 'onerror';
	$$$('returnmessage4').innerHTML = msg;
}

function checkusername() {
	var username = trim($$$('username').value);
	if(username == '' || username == lastusername) {
		return;
	} else {
		lastusername = username;
	}
	var unlen = username.replace(/[^\x00-\xff]/g, "**").length;
	if(unlen < 3 || unlen > 15) {
		errorhandle_register(unlen < 3 ? profile_username_tooshort : profile_username_toolong, {'key':1});
		return;
	}
		ajaxget('index.php?option=misc&task=ajax&infloat=register&handlekey=register&action=checkusername&username=' + (BROWSER.ie && document.charset == 'utf-8' ? encodeURIComponent(username) : username), 'returnmessage4');
}

function checkemail() {
	var email = trim($$$('email').value);
	if(email == '' || email == lastemail) {
		return;
	} else {
		lastemail = email;
	}
	ajaxget('index.php?option=misc&task=ajax&infloat=register&handlekey=register&action=checkemail&email=' + email, 'returnmessage4');
}

function trim(str) {
	return str.replace(/^\s*(.*?)[\s\n]*$/g, '$1');
}

</script>
<!--{/if}-->

<!--{eval updatesession();}-->
<!--{if empty($_G['gp_infloat'])}-->
	</div></div>
</div>
<!--{/if}-->
<!--{template common/footer}-->